<div class="title">User verwalten</div>

<?php echo $this->element('flashMessage') ?>

<table>
	<tr>
		<th>User</th>
		<th class="noprint">Aktion</th>
		<th>Status</th>
	</tr>
	<?php
	$out = '';
	foreach($this->data as $key => $value){
		$userId = $value['User']['id'];
		$out .='<tr>';
		$out .='<td>';
		$name = $value['User']['first_name'].' '.$value['User']['family_name'];
		$name .= ' ('.$value['User']['username'].')';
		$out .= $name;
		
		$out .='</td>';
		$out .='<td class="noprint">';
		$out .= $this->Html->link('Ändern',array('action'=>'update',$value['User']['id']));
		if($value['User']['state_id']==1){
			$options = array('style'=>'color:green');
			$active = $this->Html->link('Aktiv',array('action'=>'setState',$userId,2),$options);
		}else{
			$options = array('style'=>'color:red');
			$active = $this->Html->link('IN-Aktiv',array('action'=>'setState',$userId,1),$options);
		}
		$out .='</td>';
		$out .='<td>';
		$out .= $active;
		$out .='</td>';
		$out .='</tr>';
	}
	echo $out;
	?>
</table>
